1 #include "stdio.h"
2 #include "stdlib.h"
3 #include "config.h" // 执行 cmake 时自动生成
4 #ifdef USE_MYMATH
5 #include "MathFunctions.h"
6 #else
7 #include "math.h"
8 #endif
9 int main(int argc, char *argv[])
10 {
11 if (argc < 3)
12 {
13 printf("Usage: %s base exponent \n", argv[0]);
14 return 1;
15 }
16 double base = atof(argv[1]);
17 int exponent = atoi(argv[2]);
18 #ifdef USE_MYMATH
19 double result = power(base, exponent);
20 #else
21 double result = pow(base, exponent);
22 #endif
23 printf("%g ^ %d is %g\n", base, exponent, result);
24 return 0;
25 }